<?php
namespace Home\Controller;
use Think\Controller;
class BaseController extends Controller {
    function _initialize(){
        import('Vendor.Alipay.AopSdk');
        import('Vendor.Alipay.Aop.AopClient.class');
//        $obj=new AopSdk();
//        var_dump($obj);
//        Vendor("Alipay.AopSdk");
        $c = new \AopClient();
        $c->gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
        $c->appId = "2016082500309701";
        $c->rsaPrivateKey = 'MIIEowIBAAKCAQEAruCrfrwF2ffFJlmb6C+ur0Sn7u5lxdEICEEEM1a31yEfhzX9+iGreA7zkp0cUUoRGWBTmUUsCPAj7bB9SIMXO7J3KLkBVo9nIxHLxWDWW6jKZ3ZfKMOg57TPqZ7diY7IYDG5sZ3mn+v+sA5XxbgvzL6y791MIHSK16Uv4f5BLd/vFMJuIj7sfl4azQHC5Eyr3rEwWOIgCZCiUwRsjMhoLpVzSs+wtoYmcXeuKOB3Iv99lnGm4VjBhb3gDgT16T2Ftk1qxqx4KG1cLMoJB+Q0Wl3+0HGrHC9RZxmGefsfWM3KlYfaI5vzgXqf9enxMnHRf3NbRajblEAolF/BuTcrrwIDAQABAoIBAD+tn8TuQlM0XZ2xU4wgkMNRhLUEKhr2Gq6mvhjTou27KffaOTkzuXRmPVtNylnvVnqfENHm1joK94o9keEtmvAp9Cnn9AzI+w1SFZkxwdxuggVanRwC4Dx/In7pUlIco+ojMTL0BF6HWJ5TGrLsdrtfVVjyhB3tUgFkLSNlqeZB4fzHRyX3RwH+Q3AP/6W4YDjD+QxLwzoelu83Aeo3wRmsjEr0BxhPDck/CzDCCxhlUqV2az6O0Hg7f/rGDUBTam0BMAIs06TL/y1bB4bouI/x9W5hJ6mtYhXnYuVrJCaTeLzzFhavYfd8XFfNdONT9tGOfwEOydsmhXrh3E9ikEECgYEA5V/nGFZ/k5FUZjW/zuT1J0cxh+J750lqG7tuvWrGc+YwHmifE+uuF/9pvHDIjgoRqjZSvY6ildcfQL+uGOFP45ZJKgp/n+hm7f/LxQcBPnUsbbn/mnHunl9s+IFUKK/WHnpL7GllB3bsaJmITaQA3TTIOpY7ByoI2V3MiKqzIssCgYEAwy1VgAx47AHV5d6Jcalvp8P+euOukqBgsz3s3WBhb5ceH4JTbusL03v1LjleEdXmPa0W7DAEtL8N7ZeQiLAKslco7g3+yHEeKOeglYLmkhR0BPDJMWrzE/iN0pNR/DhKUu9s0C+6j/gJU40FlwSxCdvnc+9jahBF5FpIe422ai0CgYAQ0vr5XwbWhRdis9iQzVxp+B/a7rLV4R2mURYrUJSj1aN754KbjHLlkbdougEL4hMvn/JrsvWb9f512llju8sHT3OoYMLBsOMz28pPdlcSBLgwiC8GXgr5lNhCVgIdReB3tdKx0X02kfN/LJvBziC+GOwC2BgWS3AAuY+SCqs/BwKBgDnYErHrgF75wEnrJTLhc2z2IlKLbe6Yx2/3115YtSfcUpomBtIlqRCZeTWk3ONOUHlQ9i0zogFrahZTSAuqmND4EfJThYIkPDsFQstsyybaFvRr5ETYHIh7rpSNAsxMZoKj4MzmiFUovqLbdZ+nTUzNto/ej8kcX4po03iCrGBVAoGBAIuWGaAPPJbsrjvwdf1vstoyAy5uIvk/5jX8Zrym+VvJfxWtrHs/ugmgBfPOqhpd7HAIaMiZ6O5IuX1JBrpvJm1sNM1tIO20X4H+B7aoqN+CTNPRKfUCBtY0wKCxFusPPiGoBCcdWXz/aicfk3I0zhtBauHJYd42YuLk/zuzUtwv' ;
        $c->format = "json";
        $c->charset= "UTF-8";
        $c->signType= "RSA2";
        $c->alipayrsaPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3fgWjzl+dxaDFgTyN+VAUdv3J432aA0ykK+JWX+CIDy/iKuZWB3OTi0TIwTd/VeOtmi3QPt13Be6mP6YYrtsVLO+e/zeg46wQwmrCr9fx1AQLA+uae3EjTrpT5tZ/buFgdEfPHUxdhpZQXyvCmXVuiVZl8MKPxZv+JXQoLyYDva4gbAHxscRdWOuDzp7pGK/hYzau8x14H+GD4zS9u7NS/MYqsrgY0wcaRqzPyUHVMsAFz6rDgQT52fvk2PMMswdo0cnL/b7qzuOVCdTe6SBq/Edj7MIjdOC2VxU9tATyXKxpJkdcyoMLEeGBdpBStwVa4EXf4vA/VaiITwdO/yOWQIDAQAB';
//实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称：alipay.open.public.template.message.industry.modify
        $request = new AlipayOpenPublicTemplateMessageIndustryModifyRequest();
//SDK已经封装掉了公共参数，这里只需要传入业务参数
//此次只是参数展示，未进行字符串转义，实际情况下请转义
        $request->bizContent = "{" +
            "    \"primary_industry_name\":\"IT科技/IT软件与服务\"," +
            "    \"primary_industry_code\":\"10001/20102\"," +
            "    \"secondary_industry_code\":\"10001/20102\"," +
            "    \"secondary_industry_name\":\"IT科技/IT软件与服务\"" +
            " }";
        $response= $c->execute($request);
        echo "<pre>";
        var_dump($response);die;
    }
    /*
*
* @actime_name:操作名称
* @time:操作时间
* */
    public function rizhi($action_name, $time)
    {

        $addr = $_SERVER['REMOTE_ADDR'];
        $name = session("name");
        //确定操作者身份的id
        $id = M("userbase")->field("uid")->where("name='" . $name . "'")->find();
        //记录到日志
        $id = $id['uid'];
        M()->execute("insert into admin_user_log(uid,addr,action,create_time) value('$id','$addr','$action_name','$time')");

    }

}
